home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-21 | 1.5 KB | 64 lines | [TEXT/MPS ] |
- SEG 'More'
- DATAREFS RELATIVE
-
- IMPORT _neighbour:DATA ;; from rules
- IMPORT _distance:DATA ;; from rules
-
- IMPORT ballVal:DATA ;; from own file
- IMPORT firstTime:DATA ;; from own file
- IMPORT InitArnold:CODE ;; from own file
-
- Arnold FUNC EXPORT
-
- LINK A6,#$FFFFFFFE
-
- JSR InitArnold ;; Lengthy initialisation in C
-
- movem.l d3-d6/a2, -(a7) ;; save non-temp registers
-
- ;; register initialisation
-
- moveq #0, d0
- moveq #0, d2
- moveq #0, d4
- move $000e(a6), d6 ;; !!! IN THINK, OFFSET IS $000C
- movea.l $0008(a6), a0
- lea.l ballVal, a1
- lea.l _neighbour, a2
-
- moveq #0, d5 ;; f = 1
- L_1 addq #7, a2 ;; a2 = _neighbour[f][0]
- adda.l #128, a1 ;; a1 = ballVal[f][0]
-
- move.b 1(a0, d5.w), d4 ;; d4 = board->field[f]
- beq.s L_6 ;; if (! (owner = board->field[f])) continue;
-
- moveq #0, d1
- moveq #5, d3 ;; d = topleft
-
- ;; Most Inner Loop
-
- L_3 move.b 0(a2, d3.w), d2 ;;* d2 = Neighbour (f, d)
- cmp.b 0(a0, d2.w), d4 ;; if (board->field[Neighbour (f, d)] == owner)
- bne.s L_4
- bset d3, d1 ;; index |= (1 << d)
- L_4 dbra d3, L_3
- lsl #1, d1 ;; shorts (not bytes).
-
- cmp d6, d4 ;; if (owner == player)
- bne.s L_5
- add 0(a1, d1.w), d0 ;; boardValue += ballVal[f][index]
- bra.s L_6 ;; else
- L_5 sub 0(a1, d1.w), d0 ;; boardValue -= ballVal[f][index]
-
- L_6 addq #1, d5
- cmp #$003d, d5
- blt.s L_1
-
- movem.l (a7)+, d3-d6/a2 ;; restore non-temp registers
-
- UNLK A6
- RTS
-
- ENDF
- END